from turtle import *
from datetime import datetime

# 左手
def left_hand():
    penup()
    goto(177, 112)
    pencolor("lightgray")
    pensize(3)
    fillcolor("white")
    begin_fill()
    pendown()
    setheading(80)
    circle(-45, 200)
    circle(-300, 23)
    end_fill()

# 左手内
def left_hand_inside():
    penup()
    goto(182, 95)
    pencolor("black")
    pensize(1)
    fillcolor("black")
    begin_fill()
    setheading(95)
    pendown()
    circle(-37, 160)
    circle(-20, 50)
    circle(-200, 30)
    end_fill()

# 头顶
def head():
    penup()
    goto(-73, 230)
    pencolor("lightgray")
    pensize(3)
    fillcolor("white")
    begin_fill()
    pendown()
    setheading(20)
    circle(-250, 35)

# 左耳
def left_ear():
    setheading(50)
    circle(-42, 180)

# 左侧
def left_body():
    setheading(-50)
    circle(-190, 30)
    circle(-320, 45)

# 左腿
def left_leg():
    circle(120, 30)
    circle(200, 12)
    circle(-18, 85)
    circle(-180, 23)
    circle(-20, 110)
    circle(15, 115)
    circle(100, 12)

# 右腿
def right_leg():
    circle(15, 120)
    circle(-15, 110)
    circle(-150, 30)
    circle(-15, 70)
    circle(-150, 10)
    circle(200, 35)
    circle(-150, 20)

# 右手
def right_hand():
    setheading(-120)
    circle(50, 30)
    circle(-35, 200)
    circle(-300, 23)

# 右侧
def right_body():
    setheading(86)
    circle(-300, 26)

# 右耳
def right_ear():
    setheading(122)
    circle(-53, 160)
    end_fill()

# 右耳内
def right_ear_inside():
    penup()
    goto(-130, 180)
    pencolor("black")
    pensize(1)
    fillcolor("black")
    begin_fill()
    pendown()
    setheading(120)
    circle(-28, 160)
    setheading(210)
    circle(150, 20)
    end_fill()

# 左耳内
def left_ear_inside():
    penup()
    goto(90, 230)
    setheading(40)
    begin_fill()
    pendown()
    circle(-30, 170)
    setheading(125)
    circle(150, 23)
    end_fill()

# 右手内
def right_hand_inside():
    penup()
    goto(-180, -55)
    fillcolor("black")
    begin_fill()
    setheading(-120)
    pendown()
    circle(50, 30)
    circle(-27, 200)
    circle(-300, 20)
    setheading(-90)
    circle(300, 14)
    end_fill()

# 左腿内
def left_leg_inside():
    penup()
    goto(108, -168)
    fillcolor("black")
    begin_fill()
    pendown()
    setheading(-115)
    circle(110, 15)
    circle(200, 10)
    circle(-18, 80)
    circle(-180, 13)
    circle(-20, 90)
    circle(15, 60)
    setheading(42)
    circle(-200, 29)
    end_fill()

# 右腿内
def right_leg_inside():
    penup()
    goto(-38, -210)
    fillcolor("black")
    begin_fill()
    pendown()
    setheading(-155)
    circle(15, 100)
    circle(-10, 110)
    circle(-100, 30)
    circle(-15, 65)
    circle(-100, 10)
    circle(200, 15)
    setheading(-14)
    circle(-200, 27)
    end_fill()

# 右眼
def right_eye():
    # 眼圈
    penup()
    goto(-64, 120)
    begin_fill()
    pendown()
    setheading(40)
    circle(-35, 152)
    circle(-100, 50)
    circle(-35, 130)
    circle(-100, 50)
    end_fill()
    # 眼珠
    penup()
    goto(-47, 55)
    fillcolor("white")
    begin_fill()
    pendown()
    setheading(0)
    circle(25, 360)
    end_fill()
    penup()
    goto(-45, 62)
    pencolor("darkslategray")
    fillcolor("darkslategray")
    begin_fill()
    pendown()
    setheading(0)
    circle(19, 360)
    end_fill()
    penup()
    goto(-45, 68)
    fillcolor("black")
    begin_fill()
    pendown()
    setheading(0)
    circle(10, 360)
    end_fill()
    penup()
    goto(-47, 86)
    pencolor("white")
    fillcolor("white")
    begin_fill()
    pendown()
    setheading(0)
    circle(5, 360)
    end_fill()

# 左眼
def left_eye():
    # 眼圈
    penup()
    goto(51, 82)
    fillcolor("black")
    begin_fill()
    pendown()
    setheading(120)
    circle(-32, 152)
    circle(-100, 55)
    circle(-25, 120)
    circle(-120, 45)
    end_fill()
    # 眼珠
    penup()
    goto(79, 60)
    fillcolor("white")
    begin_fill()
    pendown()
    setheading(0)
    circle(24, 360)
    end_fill()
    penup()
    goto(79, 64)
    pencolor("darkslategray")
    fillcolor("darkslategray")
    begin_fill()
    pendown()
    setheading(0)
    circle(19, 360)
    end_fill()
    penup()
    goto(79, 70)
    fillcolor("black")
    begin_fill()
    pendown()
    setheading(0)
    circle(10, 360)
    end_fill()
    penup()
    goto(79, 88)
    pencolor("white")
    fillcolor("white")
    begin_fill()
    pendown()
    setheading(0)
    circle(5, 360)
    end_fill()

# 鼻子    
def nose(): 
    penup()
    goto(37, 80)
    fillcolor("black")
    begin_fill()
    pendown()
    circle(-8, 130)
    circle(-22, 100)
    circle(-8, 130)
    end_fill()

# 嘴
def mouth():  
    penup()
    goto(-15, 48)
    setheading(-36)
    begin_fill()
    pendown()
    circle(60, 70)
    setheading(-132)
    circle(-45, 100)
    end_fill()

# 彩虹圈
def rainbow():
    penup()
    goto(-135, 120)
    pensize(5)
    pencolor("cyan")
    pendown()
    setheading(60)
    circle(-165, 150)
    circle(-130, 78)
    circle(-250, 30)
    circle(-138, 105)
    penup()
    goto(-131, 116)
    pencolor("slateblue")
    pendown()
    setheading(60)
    circle(-160, 144)
    circle(-120, 78)
    circle(-242, 30)
    circle(-135, 105)
    penup()
    goto(-127, 112)
    pencolor("orangered")
    pendown()
    setheading(60)
    circle(-155, 136)
    circle(-116, 86)
    circle(-220, 30)
    circle(-134, 103)
    penup()
    goto(-123, 108)
    pencolor("gold")
    pendown()
    setheading(60)
    circle(-150, 136)
    circle(-104, 86)
    circle(-220, 30)
    circle(-126, 102)
    penup()
    goto(-120, 104)
    pencolor("greenyellow")
    pendown()
    setheading(60)
    circle(-145, 136)
    circle(-90, 83)
    circle(-220, 30)
    circle(-120, 100)
    penup()
   
# 爱心
def love_heart():
    penup()
    goto(220, 115)
    pencolor("brown")
    pensize(1)
    fillcolor("brown")
    begin_fill()
    pendown()
    setheading(36)
    circle(-8, 180)
    circle(-60, 24)
    setheading(110)
    circle(-60, 24)
    circle(-8, 180)
    end_fill()

# 五环
def wuhuan():  
    penup()
    goto(-5, -170)
    pendown()
    pencolor("blue")
    circle(6)
    penup()
    goto(10, -170)
    pendown()
    pencolor("black")
    circle(6)
    penup()
    goto(25, -170)
    pendown()
    pencolor("brown")
    circle(6)
    penup()
    goto(2, -175)
    pendown()
    pencolor("lightgoldenrod")
    circle(6)
    penup()
    goto(16, -175)
    pendown()
    pencolor("green")
    circle(6)
    penup()

# 北京2022文字
def write_beibing():
    pencolor("black")
    goto(-26, -160)
    pendown()
    write("BEIJING 2022", font=('Arial', 10, 'bold italic'))
    penup()


def write_author():
    pencolor("black")
    goto(250, -323)
    pendown()
    write("draw by 关机闹钟", font=('Arial', 20, 'normal'))
    penup()
    goto(250, -353)
    pendown()
    write(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), font=('Arial', 20, 'normal'))
    penup()


# 画布，画笔设置
def init():
    speed(20)
    hideturtle()

def main():
    init()
    left_hand()
    left_hand_inside()
    head()
    left_ear()
    left_body()
    left_leg()
    right_leg()
    right_hand()
    right_body()
    right_ear()
    right_ear_inside()
    left_ear_inside()
    right_hand_inside()
    left_leg_inside()
    right_leg_inside()
    right_eye()
    left_eye()
    nose()
    mouth()
    rainbow()
    love_heart()
    wuhuan()
    write_beibing()
    write_author()
    done() 

if __name__ == '__main__':
    main()